<?php
/**
 * 发送邮件函数
 * @param 发件人信息 $send_info
 * array("Host"=>"127.0.0.1","userNmae"=>"rfh2fg2nc@itylwabc.com","pwd"=>"4574f56b","displayName"=>"周日粉")
 * @param 收件人地址 $Addressee
 * array("88ddqq@163.com","331048265@qq.com")
 * @param 邮件标题 $title
 * @param 发送内容 $body
 */
set_time_limit(0);
include_once 'libEmail/phpmailer.php';
include_once 'libEmail/pop3.php';
include_once 'libEmail/smtp.php';

function send_email_function($send_info=array(),$Addressee=array(),$title,$body){
	set_time_limit(0);
	/*echo "{$send_info['userNmae']}:{$Addressee[0]},".count($Addressee)."<br>";
	return true;*/
	
	$mail = new mailer_phpmailer();
	$mail->IsSMTP();
	$mail->SMTPDebug = 1;
	$mail->SMTPAuth = true;
	$mail->CharSet = "utf-8";
	
	$mail->Host = $send_info["Host"];
	$mail->Port = 25;
	$mail->Username = $send_info["userNmae"];
	$mail->Password = $send_info["pwd"];
	$mail->SetFrom($send_info["userNmae"], $send_info["displayName"]);
	
	$mail->Subject = $title;
	$mail->MsgHTML($body);
	
	foreach ($Addressee as $key => $value) {
		if(empty($key))
			$mail->AddAddress($value, null);//增加收件人
		else 
			$mail->AddBCC($value, null);//加密的收件人
	}
	
	return ($mail->Send() === true)?true:false;
}
/*
$send_info = array("Host"=>"127.0.0.1","userNmae"=>"user1@it8.com","pwd"=>"admin","displayName"=>"周日粉");
//$Addressee = array("88ddqq@163.com","331048265@qq.com");
$Addressee = array("331048265@qq.com");

echo send_email_function($send_info,$Addressee,"邮件标题","邮件内容");
*/